

import getTableData from '../request-functions/getTableData';

const batchAddSubTemplate = 'batchAddSub';
const batchAddSubTaleTemplate = 'batchAddSubTaleTemplate';

export default function() {
    let {
        func_type,
        param_str,
        pk_org,
        form: {
            isCheckNow
        }
    } = this.props;

    const {
        currentForm,
        currentFormValue
    } = this.state;

    let postData = {
        func_type,
        param_str,
        pk_org,
        model: currentFormValue,
        table_code: currentForm
    };

    if(isCheckNow(batchAddSubTemplate)) {
        getTableData(postData)
            .then((res) => {
                if(res.success) {
                    this.setState({
                        step: 2
                    }, () => {
                        this.renderTable(res.data[currentForm]);
                    });
                }
            });
    }
}
